//
//  PhotoPasswordViewController.m
//  Diary
//
//  Created by lanou3g on 16/1/21.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "PhotoPasswordViewController.h"

@interface PhotoPasswordViewController ()

@end

@implementation PhotoPasswordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(testing) name:UITextFieldTextDidChangeNotification object:nil];
    _saveButton.enabled = NO;
    
}


- (IBAction)saveButtonAction:(id)sender {
    
    NSString *photoPasTx1 = _photoPasTx1.text;
    NSString *photoPasTx2 = _photoPasTx2.text;
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:photoPasTx1 forKey:@"photoPasTx1"];
    [userDefaults setObject:photoPasTx2 forKey:@"photoPasTx2"];
    
    [self.navigationController popViewControllerAnimated:YES];
    
}

- (void)testing{
    
    if (_photoPasTx1.text.length >= 1 && _photoPasTx2.text.length >= 1) {
        
        _saveButton.enabled = YES;
        
    }else{
        
        _saveButton.enabled = NO;
    }
    
}



@end
